#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
void handler(int signo)
{
    while(waitpid(-1,NULL,WNOHANG)>0)
    {
        printf("wait success,get signal:%d\n",signo);
        sleep(1);
    }
    printf("Over\n");
}
int main(void)
{
    signal(17,handler);
    if(fork()==0)
    {
        printf("Child process pid:%d\n",getpid());
        sleep(3);
        exit(0);
    }
    sleep(3);
    printf("father process pid:%d\n",getpid());
    while(1);
    return 0;
}
